package com.chenyue.cm.user.client.impl;




import com.chenyue.cm.bean.Success;
import com.chenyue.cm.user.client.MallMemberServiceClient;
import com.chenyue.cm.user.domain.JdAppUser;
import com.chenyue.cm.user.domain.JdMemberAddress;
import com.chenyue.cm.user.service.JdAppUserService;
import com.chenyue.cm.user.service.JdMemberAddressService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * 描述: author: chenyue date: 2020-02-24
 */
@Service(value = "MallMemberClientService")
public  class MallMemberClientServiceImpl implements MallMemberServiceClient {

    @Resource
    private JdAppUserService jdAppUserService;

    @Resource
    private JdMemberAddressService memberAddressService;



    @Override
    public Success getMemberDetailById(String userId) {
        System.out.println("userId----"+userId);
        JdAppUser appUser = jdAppUserService.selectByPrimaryKey(userId);
        return Success.success(appUser);
    }

    @Override
    public Success getAddressList(String userId) {
        System.out.println("userId----"+userId);
        List<JdMemberAddress> memberAddressList = memberAddressService.getMemberAddressList(userId);
        return Success.success(memberAddressList);
    }

    @Override
    public Success getAddressDetailById(String userId, String addressId) {
        System.out.println("userId----"+userId);
        System.out.println("addressId----"+addressId);
        JdMemberAddress memberAddress = memberAddressService.selectByPrimaryKey(addressId);
        return Success.success(memberAddress);
    }
}
